package JavaSe;

import java.lang.reflect.Field;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}15:23
 */
public class StringTest {

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        testReflection();
    }

    public static void testReflection() throws NoSuchFieldException, IllegalAccessException {
        String s = "Hello World";

        System.out.println(s);

        Field valueFieldOfString = String.class.getDeclaredField("value");

        valueFieldOfString.setAccessible(true);

        char[] calue = (char[]) valueFieldOfString.get(s);

        calue[5] = '_';

        System.out.println(s);
    }
}
